{include file="public/header" /}
<div class="layui-card" xmlns: xmlns:>
    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
        </ul>

        <div class="layui-tab-content" >
            <div class="layui-tab-item layui-show">
                <form class="layui-form layui-form-pane" action="/admin/news/add" method="post" id="add">
                    <input type="hidden" name="id" value="{$v.id}">
                    <input type="hidden" name="pid" value="{$v.pid}">
                    <input type="hidden" name="ty" value="{$v.ty}">
                    <input type="hidden" name="tty" value="{$v.tty}">
                    <input type="hidden" name="ttty" value="{$v.ttty}">


                    {if condition="in_array(1,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-inline">
                            <input type="text" name="title" value="{$v.title}" required lay-verify="required" placeholder="请输入标题" class="layui-input">
                        </div>
                    </div>
                    {/if}
                    {if condition="in_array(2,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">副标题</label>
                        <div class="layui-input-inline">
                            <input type="text" name="ftitle" value="{$v.ftitle}" placeholder="请输入副标题" class="layui-input">
                        </div>
                    </div>
                    {/if}

                    {if condition="$v.pid eq 'w'"}
<!--                        <div class="layui-form-item">-->
<!--                            <label class="layui-form-label">分类</label>-->
<!--                            <div class="layui-input-inline">-->

<!--                                <select name="type">-->
<!--                                    <option value="0">请选择</option>-->
<!--                                    {volist name=":get_tag(15,30,31,0,'*')" id="v2"}-->
<!--                                        <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['type']"}selected{/if}>{$v2['title']}</option>-->
<!--                                    {/volist}-->
<!--                                </select>-->

<!--                            </div>-->
<!--                        </div>-->
<!--                        <div class="layui-form-item">-->
<!--                            <label class="layui-form-label">大区</label>-->
<!--                            <div class="layui-input-inline">-->

<!--                                <select name="region">-->
<!--                                    <option value="0">请选择</option>-->
<!--                                    {volist name=":get_tag(15,30,32,0,'*')" id="v2"}-->
<!--                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['region']"}selected{/if}>{$v2['title']}</option>-->
<!--                                    {/volist}-->
<!--                                </select>-->

<!--                            </div>-->
<!--                        </div>-->
                        <div class="layui-form-item">
                            <label class="layui-form-label">服务器</label>
                            <div class="layui-input-inline">

                                <select name="server">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,33,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['server']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>

                            </div>
                        </div>
                    {/if}
                    {if condition="$v.pid eq 'w'"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">分类</label>
                        <div class="layui-input-inline">

                            <select name="type">
                                <option value="0">请选择</option>
                                {volist name=":get_tag(15,30,34,0,'*')" id="v2"}
                                <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['type']"}selected{/if}>{$v2['title']}</option>
                                {/volist}
                            </select>

                        </div>
                    </div>

                    {/if}

                    {if condition="$v.pid eq 'w'"}
                        <div class="layui-form-item">
                            <label class="layui-form-label">大区</label>
                            <div class="layui-input-inline">

                                <select name="region">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,35,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['region']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">段位</label>
                            <div class="layui-input-inline">
                                <select name="dw">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,36,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['dw']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>

                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">皮肤数量</label>
                            <div class="layui-input-inline">
                                <select name="pfsl">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,37,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['pfsl']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">5级铭文</label>
                            <div class="layui-input-inline">
                                <select name="mw">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,38,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['mw']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">限定皮肤</label>
                            <div class="layui-input-inline">
                                <select name="xdpf">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,39,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['xdpf']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">限定英雄水晶</label>
                            <div class="layui-input-inline">
                                <select name="xdsj">
                                    <option value="0">请选择</option>
                                    {volist name=":get_tag(15,30,40,0,'*')" id="v2"}
                                    <option value="{$v2['id']}" {if condition="$v2['id'] eq $v['xdsj']"}selected{/if}>{$v2['title']}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                    {/if}


                    {if condition="in_array(5,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">外链</label>
                        <div class="layui-input-inline">
                            <input type="text" name="linkurl" value="{$v.linkurl}" required lay-verify="required" placeholder="请输入外链" class="layui-input">
                        </div>
                    </div>
                    {/if}

                    {if condition="in_array(6,$arr)"}
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>简介</label>
                            <div class="layui-input-block">
                                <textarea placeholder="请输入内容" name="introduce" class="layui-textarea">{$v.introduce}</textarea>
                            </div>
                        </div>
                    {/if}

                    {if condition="in_array(7,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">SEO关键字</label>
                        <div class="layui-input-inline">
                            <input type="text" name="seokeywords" value="{$v.seokeywords}" placeholder="请输入SEO关键字" class="layui-input">
                        </div>
                    </div>
                    {/if}
                    {if condition="in_array(8,$arr)"}
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>SEO描述</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入SEO描述" name="seodescription" class="layui-textarea">{$v.seodescription}</textarea>
                        </div>
                    </div>
                    {/if}

                    {if condition="in_array(9,$arr)"}
                        <div class="layui-form-item">
                            <label for="link" class="layui-form-label">
                                <span class="x-red">*</span>文章内容
                            </label>
                            <div class="layui-input-inline">
                                <textarea  id="content" placeholder="" name="content">{$v.content}</textarea>
                            </div>
                        </div>
                    {/if}

                    {if condition="in_array(10,$arr)"}
                        <?php $course = controller("Common");?>
                            {switch name="$v['imgtype']" }

                            {case value="1"}
                                <div class="layui-form-item">
                                    <label for="link" class="layui-form-label">
                                        <span class="x-red">*</span>{:$course->get_imgname(1,$v['pid'],$v['ty'],$v['tty'])}</label>
                                    <div class="layui-input-inline">
                                        <div class="site-demo-upbar">
                                            <button type="button" class="layui-btn" id="editimg1"><i class="layui-icon"></i>上传图片</button><font color="red">图片大小:{:get_cfg_var("post_max_size")}内,图片尺寸：{:$course->get_imgsize($i,$v['pid'],$v['ty'],$v['tty'],$v['ttty'])}px</font>

                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item imgs" id="imgshow">
                                    <label  class="layui-form-label">{:$course->get_imgname(1,$v['pid'],$v['ty'],$v['tty'])}展示</label>

                                    <img src="{$v['img1']}" id="pimages1"  style="max-width: 200px;"/>
                                    <input id="avatar1" name="img1"    required="" type="hidden"  value="{$v['img1']}">

                                </div>
                            {/case}
                            {case value="2"}
                                <div class="layui-form-item">
                                    <label for="link" class="layui-form-label">
                                        <span class="x-red">*</span>{:$course->get_imgname($i,$v['pid'],$v['ty'],$v['tty'])}</label>
                                    <div class="layui-input-inline">
                                        <div class="site-demo-upbar">
                                            <button type="button" class="layui-btn" id="water_btn1"><i class="layui-icon"></i>上传图片</button><font color="red">图片大小:{:get_cfg_var("post_max_size")}内,图片尺寸：{:$course->get_imgsize($i,$v['pid'],$v['ty'],$v['tty'],$v['ttty'])}px</font>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-form-item imgs">
                                    <label  class="layui-form-label">{:$course->get_imgname($i,$v['pid'],$v['ty'],$v['tty'])}展示</label>

                                    <img src="{$v['img1']}" id="pimages1"  style="max-width: 200px;"/>
                                    <input id="wateravatar1" name="img1"    required="" type="hidden"  value="{$v['img1']}">
                                </div>
                            {/case}
                            {default /}
                                {for start="1" end="$v['imgnum']"}
                                    <div class="layui-form-item">
                                        <label for="link" class="layui-form-label">
                                            <span class="x-red">*</span>{:$course->get_imgname($i,$v['pid'],$v['ty'],$v['tty'])}</label>
                                        <div class="layui-input-inline">
                                            <div class="site-demo-upbar">
                                                <button type="button" class="layui-btn" id="test{$i}"><i class="layui-icon"></i>上传图片</button><font color="red">图片大小:{:get_cfg_var("post_max_size")}内,图片尺寸：{:$course->get_imgsize($i,$v['pid'],$v['ty'],$v['tty'],$v['ttty'])}px</font>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item layui-input-inline" id="imgshow">
                                        <label  class="layui-form-label">{:$course->get_imgname($i,$v['pid'],$v['ty'],$v['tty'])}展示</label>

                                        <img src="{$v['img'.$i]}" id="pimages{$i}"  style="max-width: 200px;"/>
                                        <input id="avatar{$i}" name="img{$i}"  class="layui-input"   type="text"  value="{$v['img'.$i]}">
                                    </div>
                                {/for}
                            {/switch}


                    {/if}





                    {if condition="in_array(16,$arr)"}
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>上传多张图片</label>
                            <div class="layui-input-block">
                                <button type="button" class="layui-btn" id="moreimg222">多图片上传</button>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="demo">
                                        {volist name="imglist" id="v2"}
                                            <div class="moreimg">
                                                <img src="{$v2['img1']}" clss="layui-upload-img" style="max-width: 200px">
                                                <div class="moreinput">标题：<input type="text" name="phototitle[]" value="{$v2['title']}"></div>
                                                <div class="moreinput">排序：<input type="text" name="photodisorder[]" value="{$v2['disorder']}"></div>
                                                <input type="hidden" value="{$v2['img1']}" class="moreimg" name="photoimg[]">
                                                <input type="hidden" value="{$v2['id']}" class="moreimgid" name="photoid[]">
                                                <i class="layui-icon moreimgdel"></i>
                                            </div>
                                        {/volist}
                                    </div>
                                </blockquote>
                            </div>


                        </div>
                    {/if}

                    {if condition="in_array(11,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">文件上传</label>
                        <div class="layui-input-inline">
                            <input type="text" name="file1" id="file1" value="{$v.file1}" placeholder="请选择文件上传" class="layui-input">
                        </div>
                        <button type="button" id="insert_file1" class="layui-btn" data-des="enclosure">
                            <i class="layui-icon">&#xe67c;</i>上传附件
                        </button>

                        <font color="#FF0000">文件大小:{:get_cfg_var("post_max_size")}</font>
                    </div>
                    {/if}


                    {if condition="in_array(12,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">来源</label>
                        <div class="layui-input-inline">
                            <input type="text" name="source" value="{$v.source}"  placeholder="请输入来源" class="layui-input">
                        </div>
                    </div>
                    {/if}


                    {if condition="in_array(13,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">作者</label>
                        <div class="layui-input-inline">
                            <input type="text" name="author" value="{$v.author}"  placeholder="请输入作者" class="layui-input">
                        </div>
                    </div>
                    {/if}

                    {if condition="in_array(14,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">价格</label>
                        <div class="layui-input-inline">
                            <input type="text" name="price" value="{$v.price}"  placeholder="请输入价格" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">原价</label>
                        <div class="layui-input-inline">
                            <input type="text" name="price2" value="{$v.price2}"  placeholder="请输入原价" class="layui-input">
                        </div>
                    </div>
                    {/if}


                    {if condition="in_array(15,$arr)"}
                    <div class="layui-form-item">
                        <label class="layui-form-label">人气</label>
                        <div class="layui-input-inline">
                            <input type="text" name="hits" value="{$v.hits}"  placeholder="请输入人气" class="layui-input">
                        </div>
                    </div>
                    {/if}

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>排序
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="disorder" autocomplete="off" value="{$v.disorder}" placeholder="排序值只能为数字"
                                   class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>状态
                        </label>
                        <div class="layui-input-block">
                            <input type="radio" name="status" value="1" title="显示" {if condition="$v['status'] eq 1"} checked {/if}>
                            <div class="layui-unselect layui-form-radio layui-form-radioed">
                                <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                <div>显示</div>
                            </div>
                            <input type="radio" name="status" value="0" title="隐藏" {if condition="$v['status'] eq 0"} checked {/if}>
                            <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                <div>隐藏</div>
                            </div>
                        </div>
                    </div>
                    {if condition="in_array($v['pid'],array('w'))"}

                        <div class="layui-form-item">
                            <label class="layui-form-label">
                                <span class='x-red'>*</span>发货状态
                            </label>
                            <div class="layui-input-block" id="fahuotype">
                                <input type="radio" name="fahuotype" value="1" title="自动发货" {if condition="$v['fahuotype'] eq 1"} checked {/if}>
                                <div class="layui-unselect layui-form-radio layui-form-radioed">
                                    <i class="layui-anim layui-icon layui-anim-scaleSpring"></i>
                                    <div>自动发货</div>
                                </div>
                                <input type="radio" name="fahuotype" value="0" title="手动发货" {if condition="$v['fahuotype'] eq 0"} checked {/if}>
                                <div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i>
                                    <div>手动发货</div>
                                </div>
                            </div>
                        </div>

<!--                        <div class="layui-form-item" id="num"  {if condition="$v['fahuotype'] eq 0"}style="display:none"{/if}>-->
<!--                            <label class="layui-form-label">-->
<!--                                <span class='x-red'>*</span>数量-->
<!--                            </label>-->
<!--                            <div class="layui-input-block">-->
<!--                                <input type="text" name="num" autocomplete="off" value="{$v.num}" placeholder="数量" class="layui-input">-->
<!--                            </div>-->
<!--                        </div>-->







                        <script>
                            $("#fahuotype").click(function () {
                                fahuotype=$(this).find(".layui-form-radioed").prev().val();
                                if(fahuotype==0){
                                    $("#num").css("display","none");
                                }else{
                                    $("#num").css("display","block");
                                }
                            })
                        </script>
                    {/if}

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span class='x-red'>*</span>时间
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="sendtime" value="{:date('Y-m-d H:i:s',$v.sendtime)}" readonly placeholder="请选择发布时间"  class="layui-input datetime">

                        </div>
                    </div>




                    <div class="layui-form-item">
                        <button class="layui-btn" type="submit" lay-filter="add" lay-submit="">
                            保存
                        </button>
                    </div>
                    <div style="height:100px;"></div>
            </div>



        </div>

    </div>
</div>







<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('content',{initialFrameWidth:800,initialFrameHeight:600,});
    UE.getEditor('content2',{initialFrameWidth:400,initialFrameHeight:200,});
</script>
<script>
    layui.use(['element','layer','form','upload'], function(){
        var  $ = layui.jquery;//jquery
        var lement = layui.element;//面包导航
        var layer = layui.layer;//弹出层
        var form = layui.form;
        var upload = layui.upload;
        //监听提交
        form.on('submit(add)', function(data){
            var title=$("input[name='title']").val();
            //var content=$("textarea[name='content']").val();

            var article_category_id=$('#article_category_id option:selected') .val();//所属文章类型
            //alert(title);
            //var form=$("#cate_add").serialize();
            if(title==""){
                layer.msg('文章标题不能为空',{icon:5,time:2000});return false;
            }
            if(article_category_id==""){
                layer.msg('文章类型不能为空',{icon:5,time:2000});return false;
            }
            /*if(content){
                layer.msg("文章内容不能为空！",{icon:5,time:2000});return false;
          }*/
            var data = data.field;
        });

    })
</script>


<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;

    });

</script>
<script type="text/javascript" src="/static/admin/lib/layui/layui.js"></script>
<script type="text/javascript" src="/static/admin/js/mylayui.js?v=v1.3.5"></script>
    <script>
        //多图上传
        layui.use('upload', function(){
            var $ = layui.jquery
                ,upload = layui.upload;
            //多图片上传
            upload.render({
                elem: '#moreimg222'
                // ,url: 'https://httpbin.org/post' //改成您自己的上传接口
                ,url: '/admin/uploads/moreimgupload' //改成您自己的上传接口
                ,multiple: true
                ,before: function(obj){
                    //预读本地文件示例，不支持ie8
                    obj.preview(function(index, file, result){
                    });
                }
                ,done: function(res){
                    //上传完毕
                    layer.msg('上传成功');
                    img=res.msg;
                    // $('#demo').append('<img src="'+ img +'" class="layui-upload-img" style="max-width: 200px"><input type="hidden" value="'+ img +'" name="moreimg[]">')


                    $('#demo').append('<div class="moreimg"><img src="'+ img +'" class="layui-upload-img" style="max-width: 200px"><input type="hidden" value="'+ img +'" name="moreimg[]"><div class="moreinput">标题：<input type="text" name="moretitle[]" value=""></div><div class="moreinput">排序：<input type="text" name="moredisorder[]" value="0"></div><i class="layui-icon moreimgdel1" style=" position: absolute;right: 0;top: 0;"></i></div>');

                    $.getScript("/public/static/admin/js/common.js", function(data, textStatus, jqxhr) {
                        console.log(data); //data returned
                        console.log('Load was performed.');
                        100});
                }
            });
        });
    </script>



</body>
</html>
<style>
    #edui282{
        z-index: 0!important;
    }
</style>









<script>
    layui.use(['element','layer','form','upload'], function(){
        var  $ = layui.jquery;//jquery
        var lement = layui.element;//面包导航
        var layer = layui.layer;//弹出层
        var form = layui.form;
        var upload = layui.upload;
        // 文件上传
        upload.render({
            elem: '#insert_file1'
            ,url: '/admin/uploads/fileupload' //改成您自己的上传接口
            ,accept: 'file' //普通文件
            ,done: function(data){
                $('#file1').val(data.msg);
                layer.msg('上传成功');
                //console.log(data.msg);
            },

        });


        //监听提交
        form.on('submit(add)', function(data){
            var title=$("input[name='title']").val();
            //var content=$("textarea[name='content']").val();

            var article_category_id=$('#article_category_id option:selected') .val();//所属文章类型
            //alert(title);
            //var form=$("#cate_add").serialize();
            if(title==""){
                layer.msg('文章标题不能为空',{icon:5,time:2000});return false;
            }
            if(article_category_id==""){
                layer.msg('文章类型不能为空',{icon:5,time:2000});return false;
            }
            /*if(content){
                layer.msg("文章内容不能为空！",{icon:5,time:2000});return false;
          }*/
            var data = data.field;
        });

    })
</script>


<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;

    });

</script>

</body>
</html>




{switch name="$v['imgtype']" }
{case value="1"}
    <!--裁剪开始-->
    <link rel="stylesheet" href="/static/css/cropper.min.css">
    <link rel="stylesheet" href="/static/css/ImgCropping.css">

    <script>
        layui.config({
            base: '/static/cropper/' //layui自定义layui组件目录
        }).use(['form','croppers'], function () {
            var $ = layui.jquery
                ,form = layui.form
                ,croppers = layui.croppers
                ,layer= layui.layer;
            //创建一个头像上传组件
            croppers.render({
                elem: '#editimg1'
                ,saveW:150     //保存宽度
                ,saveH:150
                ,mark:1/1    //选取比例
                ,area:'900px'  //弹窗宽度\
                ,url: "/admin/uploads/cropper"  //图片上传接口返回和（layui 的upload 模块）返回的JOSN一样
                ,done: function(data){ //上传完毕回调
                    // alert(data);
                    $("#avatar1").val(data);
                    $("#pimages1").attr('src',data);
                }
            });
        });
    </script>
    <!--裁剪结束-->
{/case}
{case value="2"}
    <!--水印上传开始-->
    <script>
        layui.use(['element','layer','form','upload'], function(){
            var  $ = layui.jquery;//jquery
            var lement = layui.element;//面包导航
            var layer = layui.layer;//弹出层
            var form = layui.form;
            var upload = layui.upload;
            var id=$("[name='id']").val();
            //指定允许上传的文件类型
                upload.render({

                    elem: '#water_btn1'
                    ,url: '/admin/uploads/waterimgupload/id/'+id //改成您自己的上传接口
                    ,accept: 'img' //普通文件
                    ,done: function(data){
                        if(data.status==0){
                            $('#pimages1').attr('src',data.msg);
                            $('#wateravatar1').val(data.msg);
                            layer.msg(data.msg);
                            layer.msg('上传成功');
                            console.log(data.msg);
                        }else{
                            layer.msg(data.msg);
                        }

                    },

                });

        })
    </script>
    <!--水印上传结束-->
{/case}
{default /}
<!--普通-->
    <script>
        layui.use(['element','layer','form','upload'], function(){
            var  $ = layui.jquery;//jquery
            var lement = layui.element;//面包导航
            var layer = layui.layer;//弹出层
            var form = layui.form;
            var upload = layui.upload;
            //指定允许上传的文件类型
            <?php for($i=1;$i<10;$i++){?>
                upload.render({

                    elem: '#test<?php echo $i;?>'
                    // ,url: 'https://httpbin.org/post' //改成您自己的上传接口
                    ,url: '/admin/uploads/imgupload' //改成您自己的上传接口
                    ,accept: 'file' //普通文件
                    ,done: function(data){
                        $('#pimages<?php echo $i;?>').attr('src',data.msg);
                        $('#avatar<?php echo $i;?>').val(data.msg);
                        // $('#pimages').attr('src',"222");
                        layer.msg('上传成功');
                        console.log(data.msg);
                    },

                });
            <?php }?>



        })
    </script>
{/switch}

























{include file="public/footer" /}
